from library.expand import Const
from library.event.sysEvent import EventModel
import functools
def trigger(eName):
    def decorator(func):
        @functools.wraps(func)
        def expand(*args,**kw):
            #to add event start event
            Const.SYSEVENT.call(eName,"before",*args,**kw)
            #to add event start event
            result=func(*args,**kw)
            #to add event complate event
            Const.SYSEVENT.call(eName,"complate",*args,**kw)
            #to add event complate event
            return result
        return expand
    return decorator